package entity

import "time"

// Warehouse define warehouse struct
type Warehouse struct {
	WarehouseID   int64     `gorm:"primaryKey;column:warehouse_id;type:bigint;not null" json:"-"`
	Enable        *bool     `gorm:"column:enable;type:tinyint(1);not null;default:1" json:"enable"`     // 1 启用 0 禁用
	WarehouseCode string    `gorm:"unique;column:warehouse_code;type:varchar(16)" json:"warehouseCode"` // 编码
	WarehouseName string    `gorm:"column:warehouse_name;type:varchar(128)" json:"warehouseName"`       // 名称
	Supervisor    string    `gorm:"column:supervisor;type:varchar(16)" json:"supervisor"`               // 仓库管理员
	Tel           string    `gorm:"column:tel;type:varchar(32)" json:"tel"`                             // 电话
	Address       string    `gorm:"column:address;type:varchar(255)" json:"address"`                    // 地址
	CreatedAt     time.Time `gorm:"column:created_at;type:datetime" json:"createdAt"`
	UpdatedAt     time.Time `gorm:"column:updated_at;type:datetime" json:"updatedAt"`
}

// TableName get sql table name.获取数据库表名
func (m *Warehouse) TableName() string {
	return "warehouse"
}
